#pragma once
#include "const.h"


class IOcontextPool
{
	using work = boost::asio::executor_work_guard<boost::asio::io_context::executor_type>;
	using work_ptr = std::unique_ptr<work>;
public:
	static IOcontextPool& GetInst();
	boost::asio::io_context& GetIOC();
	void Stop();
	~IOcontextPool();
private:
	std::vector<boost::asio::io_context> _iocs;
	std::vector<std::thread> _threads;
	std::vector<work_ptr> _works;
	std::size_t _nextIoc;


	IOcontextPool(size_t size = std::thread::hardware_concurrency());
	IOcontextPool(const IOcontextPool&) = delete;
	IOcontextPool& operator=(const IOcontextPool&) = delete;
	

};

